package com.isoft.argi.dao;

import com.isoft.argi.pojo.BoardNum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BoardDao {
	@Select("SELECT * FROM boardNum ORDER BY btime DESC LIMIT 1,1")
	public BoardNum getLastData();

//	@Select("SELECT #{sensorName} FROM boardNum ORDER BY btime DESC LIMIT 1,#{rowNum}")
	@Select("select ${sensorName} FROM boardnum WHERE time_to_sec(timediff(NOW(), btime))<#{interval}*60 ORDER BY btime desc limit 0,#{rowNum}")
	public List<Double> getIntervalData(String sensorName ,Integer interval, Integer rowNum) ;
}
